package com.demo.mapper;

import com.demo.dto.UserLoginDTO;
import com.demo.pojo.Student;
import com.demo.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {

    //登录时查询用户是否存在
    @Select("select * from sys_user where userid=#{userid}")
    User selectUserUserid(@Param("userid") String userid);

    //查询账号密码是否正确
    @Select("select * from sys_user where userid=#{userid} and password=#{password}")
    User selectUseridPasswordType(@Param("userid") String Userid, @Param("password") String password);

    //修改管理员信息
    @Update("update sys_user set fullname=#{fullname}, password=#{password}, telephone=#{telephone} where userid=#{userid}")
    void update(UserLoginDTO userLoginDTO);

    @Select("select * from sys_student where stuName=#{fullname}")
    Student getInfo(@Param("fullname") String fullname);
}
